MegaMoE on Gfx950 - #876
Merged
Merged
Conversation
Rebased onto latest main as a single commit: - MegaMoE fused stage1/stage2 + dispatch/combine, packaged as kernels/moe/mega_moe - merge-import fixes (kernels.common.mma, gemm_common_utils) - fix MEGA_TUNING_DIR after packaging (parent.parent.parent) so autotune finds kernels/comm/mega_moe_tuning_config (restores tuned tile_m; ~12% small-batch perf) Co-authored-by: Cursor <cursoragent@cursor.com>
…onstant bad_cast)
…or op, merge combine paths
…comm), update imports + docs
…m2 + mega + comm + profiler)
Formatting-only; fixes the Run ./.github/scripts/check_python_style.sh CI gate (black --check). No functional change.
…e_name, version v1)
Faithful FlyDSL port of aiter mxmoe_gemm_v2 (runtime K-loop + C-carry + B-streaming + spart/bhoist/ascale_pf/SBM/has_pad) split into gemm2_compute_v2 feeding our P2P scatter combine. gemm2 wired to the full flydsl Autotuner (disk-cached best config, per-M key, collective cross-rank bench), matching stage1. bs=8/64/512 PASS.
Add persist=True configs to the fp8 gemm2 autotune space (was fp4-only per aiter's guard, which does not apply to our own compile_mega_moe_stage2 persist branch -- verified correct, relL2 ~2.8e-3). Persist closes the large-M gap vs the V1 mixed_moe_gemm2 (bs=1024 stage2 0.335->0.288ms, ~19%->~3%); the per-M autotune picks persist at large M and non-persist at small M.
Reduce quantized scatter overhead and apply FP8 only to large batches. Align the rebased V2 path with current FlyDSL APIs and remove the obsolete mixed MoE implementation.
coderfeli
approved these changes
Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Reduce A8W4 expert-parallel MoE latency by overlapping communication with computation and eliminating intermediate kernel launches.
Technical Details
max_tok_per_rank(MTPR).FLYDSL_AUTOTUNEenvironment variable is required.Usage Notes
<= 128selects the low-latency fixed-slot path.>= 256selects the compact path.8192for a small decode batch is valid, but forces compact mode and loses the fixed-slot latency advantage.consistently on every rank.
Test Plan
v4_proA8W4 EP8 accuracy and performance sweeps for 1–32768 tokens per rank.